<?php 

$hostname = "csci.hopto.org";
$username = "root";
$password = "csci7136";
$db = "hotel_reservations2";

$results = mysql_connect($hostname, $username, $password)
or die("Could not connect to database");
mysql_select_db($db, $results)
or die("Could not select database");
function display_db_query($query_string, $connection, $header_bool) {
	$result_id = mysql_query($query_string, $connection)
	or die("display_db_query:" . mysql_error());
	$column_count = mysql_num_fields($result_id)
	or die("display_db_query:" . mysql_error());
	print("<TABLE border=1 cellspacing=0 >\n");
	if($header_bool) {
		print("<TR>");
		for($column_num = 0; $column_num < $column_count; $column_num++) {
			$field_name = mysql_field_name($result_id, $column_num);
			print("<TH>$field_name</TH>");
		}
		print("</TR>\n");
	}
	while($row = mysql_fetch_row($result_id)) {
		print("<TR ALIGN=LEFT VALIGN=TOP>");
		for($column_num = 0; $column_num < $column_count; $column_num++) {
			print("<TD>$row[$column_num]</TD>\n");
		}
		print("</TR>\n");
	}
	print("</TABLE>\n"); 
}

function display_db_table($tablename, $connection, $header_bool, $table_params) {
	$query_string = "SELECT * FROM $tablename";
	display_db_query($query_string, $connection,
	$header_bool, $table_params);
}
?>
<TABLE><TR><TD>
<?php
$table = $_GET['tbl'];

display_db_table($table, $results,
TRUE);
?>
</TD></TR></TABLE>